package com.sakura.thread.chapter1;

/**
 * Created by apple on 2018/12/10.
 */
public class WaitNotifyinterupt {
    static Object obj = new Object();

    public static void main(String[] args) throws InterruptedException {
        Thread threadA = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("begin");
                synchronized (obj){
                    try {
                        obj.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        });

        threadA.start();;
        Thread.sleep(1000);

        System.out.println("begin interrupt");
        threadA.interrupt();
        System.out.println("end interrupt");
    }
}
